//test		
		//This will be a program that displays, pixel by pixel the menu screen.
		
		//We'll have to retrieve each pixel from the sdcard and then display it to the screen.
		
		//So first access the part of memory.
		
		//As of March 19, 2012 this works.
		
loop	cp sdcard_address_low	i

		cp sdcard_address_high	i2
		
		call sdcard	sdcard_return
		
		cp	vga_x1			x			//Max value of x is 639
		cp	vga_y1			y			//Max value of y is 479
		cp	vga_x2			x
		cp	vga_y2			y
		
		out 1	i2
		
		cp	vga_color_write	sdcard_data		//Use the colors we just retrieved from the 
		cp 	vga_write 		one				//This tells the screen that we want to write this
											//to the screen.
		
		call VGA	VGA_return
											
		add i 	i 	one						//increment i.
		
i_check	be	reset	i	addr_low_max		//If i is equal to 32768 after the increment increase i2 and bring i to zero.
		
		add x 		x 	one							//increment x.
		
		blt loop 	x 	max_x						//Go back to the loop as long as x is less than 640 and within limits.
		
		call 	manage_diff 	manage_diff_return	//Once you get past that row, you need to make up for the
													//difference between the vga's size and the files size.
		
		cp 	x 	zero
		
		add y 	y 	one								//increment y.
		
		blt loop 	y 	max_y						//Go back to the loop as long as x is less than 480 and within limits.
		
nav		call mouse mouse_return

		call cursor	cursor_return
		
		bne		nav		mouse_button3	preset1 		
		
		halt
		
		//-------------------------------------
		//These are extra functions.
		//--------------------------------------
		
reset	cp 	i 		zero			//Set i to zero.
		add i2 		i2 		one		//increase i2 by one.				
		be	i_check	zero 	zero	//go back to i_check once done.
			
		halt
		
manage_diff		add i 		i 		diff_x
				blt	inside	addr_low_max 	i			//NOTE: THIS BRANCH LESS THAN IS LIKE THIS BECAUSE IN E100
														//THE NUMBER 32768 IS ACTUALLY -32768 (two's compliment).
														
														//If that addition did not add too much to i
														//skip the next part.
				
				add i2		i2		one					//If too much was added add 1 to i2
				sub i		i		addr_low_max		//then subtract from i the maximum value of sdcard_addr_low.
				
inside			ret	manage_diff_return	
		
		halt
		
one		.data 1
zero	.data 0
two		.data 2
four	.data 4
preset1	.data 1
preset0	.data 0

addr_low_max		.data	32768			//The max for 15 bits is 32767.The max of 16 bits is 65535.
addr_low_max_real	.data	32767
tenthousand			.data	10000
		
x		.data 0
y		.data 0

i		.data 0
i2		.data 0


max_x	.data 640			//Menu is 672 x 523. The difference between our and the vga's limits are 32 (x) and 43 (y).
max_y	.data 480			
		
diff_x	.data 32
diff_y	.data 43

manage_diff_return			.data 0		
		
#include sdcard_driver.e
#include VGA_driver.e
#include mousedriver.e
#include cursor2.e
		
		
